package cn.bearspark.article.provider.rpc;

import cn.bearspark.article.dto.draft.DraftDTO;
import cn.bearspark.article.dto.draft.DraftSimpleDTO;
import cn.bearspark.article.dto.draft.SaveDraftDTO;
import cn.bearspark.article.provider.service.DraftService;
import cn.bearspark.article.rpc.DraftRpc;
import cn.bearspark.common.dto.Page;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Component;

/**
 * @author f
 */
@Component
@DubboService
public class DraftRpcImpl implements DraftRpc {

    private final DraftService draftService;

    public DraftRpcImpl(DraftService draftService) {
        this.draftService = draftService;
    }

    @Override
    public long save(SaveDraftDTO saveDraftDTO) {
        return draftService.save(saveDraftDTO);
    }

    @Override
    public DraftDTO get(long draftId, long userId) {
        return draftService.get(draftId, userId);
    }

    @Override
    public void delete(long draftId, long userId) {
        draftService.delete(draftId, userId);
    }

    @Override
    public Page<DraftSimpleDTO> page(int pageNum, int pageSize, long userId) {
        return draftService.page(pageNum, pageSize, userId);
    }
}
